package com.rsk.dao;

import com.rsk.entity.SysCompanyTracks;
import com.rsk.entity.SysCompanys;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.io.Serializable;

@Repository
public interface SysCompanyTracksRepository extends JpaRepository<SysCompanyTracks, Long>, JpaSpecificationExecutor<SysCompanyTracks>, Serializable {


    @Modifying
    @Query(value = "update sys_company_tracks set is_del = 1, operator_user =?2, operator_time = NOW() where id =?1", nativeQuery = true)
    public int delSysCompanyTracks(Long id, Long operatorUser);

    @Query(value = "select 1 from sys_company_tracks where id =?1 and is_del = 0", nativeQuery = true)
    public SysCompanyTracks selectSysCompanyTracksById(Long id);

    @Modifying
    @Query(value = "update sys_company_tracks set company_id = ?2,track_Theme =?3,track_Content =?4,track_time =?5,contacts_user =?6,contacts_phone =?7,userId =?8 operator_user =?9,operator_time = NOW() where id =?1", nativeQuery = true)
    public int updateSysCompanyResponsibles(Long id, String companyId, String trackTheme,
                                               String trackContent, String trackTime, String contactsUser,
                                               String contactsPhone, Long userId, Long operatorUser);


}
